<template>
	<div class="detail">
		<div class="get-params" v-if="getparams(this.$route.params.newsId)"></div>
		<article1 :item="articledata"></article1>
		<div class="dashed"></div>
		<!--<news2 v-for="i in 4"></news2>-->
	</div>
</template>

<script>
	import { mapState, mapMutations, mapActions } from 'vuex'
	import $ from 'jquery'
	import store from '@/store'
	import Article from '@/components/main/article'
	import News2 from '@/components/main/news2'

	export default {
		name: 'detail',
		data: function() {
			return {
				newsId: ''
			}
		},
		components: {
			'article1': Article,
			'news2': News2
		},
		computed: {
			...mapState({
				articledata: state => state.DetailStore.article
			})
		},
		methods: {
			...mapMutations([

			]),
			...mapActions([
				"getDetailData"
			]),
			getparams: function(param) {
				this.newsId = param
				return param
			}
		},
		mounted: function() {
			this.getDetailData(this.newsId)
		},
		watch: {
			'$route' (to, from) {
				this.getDetailData(this.newsId)
			}
		}
	}
</script>